package cn.jiyun.service;

import cn.jiyun.dao.Udao;
import cn.jiyun.pojo.Huiyuan;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class Uservice implements cn.jiyun.service.impl.Uservice {
    @Resource
    private Udao udao;



    @Override
    public void add(Huiyuan huiyuan) {
        udao.insert(huiyuan);
    }

    @Override
    public Huiyuan hx(Integer id) {
        return udao.selectById(id);
    }

    @Override
    public void del(Integer id) {
        udao.deleteById(id);
    }

    @Override
    public void update(Huiyuan huiyuan) {
        udao.updateById(huiyuan);
    }

    @Override
    public Page<Huiyuan> qc(Page<Huiyuan> page,String input) {
        QueryWrapper qw=new QueryWrapper();
        qw.like(input!=null,"name",input);
        return udao.selectPage(page,qw);
    }

    @Override
    public List<Huiyuan> qcc(String name) {
        QueryWrapper qw=new QueryWrapper();
        qw.like(name!=null,"name",name);
        return udao.selectList(qw);
    }

    @Override
    public List<Huiyuan> dc() {


        return udao.selectList(null);
    }
}
